home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
- Subject: Re: Seek unix2dos.c OR help with tr
- Date: 14 Mar 1996 07:22:12 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca>
- References: <4i0946$7io@nuke.csu.net> <danpop.826545577@rscernix>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <danpop.826545577@rscernix>, Dan Pop <danpop@mail.cern.ch> wrote:
- >In <4i0946$7io@nuke.csu.net> mclean@futon.SFSU.EDU (Emmett Mclean) writes:
- >
- >>Does anyone have the source to a program
- >>converting a unix file into dos format?
- >>That is, each decimal 10 char is replaced
- >>with a series of a 10 and 13.
- >
- >Thinking and programming in terms of magic numbers is a bad idea.
- >Someone who is less familiar with the ASCII character set won't be able
- >to make any sense out of your code. A program which will replace '\n'
- >by the '\r' '\n' sequence will be considerably more readable, even if
- >portability is not a concern (both DOS and Unix use the ASCII character
- >set).
-
- When I know that I'm specifically dealing with ASCII control chars, I have a
- macro like:
-
- #define CTRL(C) ((C)-64)
-
- which I then use with capital letters:
-
- switch(char) {
- case CTRL('M'):
- .
- .
- .
- }
- --
-
-